package com.heima.wemedia.client;

import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmNewsService;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 黄晏凯
 */
@RestController
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveClient {

    @Autowired
    private WmSensitiveService wmSensitiveService;

    /**
     * 查询敏感词列表
     */
    @PostMapping("/list")
    public ResponseResult list(@RequestBody SensitiveDto dto) {
        return wmSensitiveService.list(dto);
    }

    /**
     * 新增敏感词
     */
    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody WmSensitive wmSensitive) {
        return wmSensitiveService.saveSensitive(wmSensitive);
    }

    /**
     * 修改敏感词
     */
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitive wmSensitive) {
        return wmSensitiveService.updateSensitive(wmSensitive);
    }

    /**
     * 删除敏感词
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitive(@PathVariable("id") Integer id) {
        return wmSensitiveService.deleteSensitive(id);
    }

}
